package org.jdcenter.rmi.impl;

import java.rmi.server.*;

class Glossary {
    public static final String HANDLER_CACHE_INITIAL_SIZE = "handler.cache.initial.size";
    public static final String HANDLER_CACHE_INCREASE_STEP = "handler.cache.increase.step";
    public static final String HANDLER_COOKIE_RESERVED_TIME = "handler.cookie.reserved.time";
    public static final String CLIENT_HANDLER_THREAD_COUNT = "client.handler.thread.count";
    public static final String CHANNEL_TICKER_PERIODS = "channel.ticker.periods";
    public static final String CHANNEL_TICKER_INITIAL_DELAY = "channel.ticker.initial.delay";
    public static final String LOCAL_CHANNEL_RESERVED_AFTER_FREE = "local.channel.reserved.after.free";
    public static final String SERVER_CALLBACK_THREAD_COUNT = "server.callback.thread.count";
    private static String host() {
        try {
            return RemoteServer.getClientHost();
        } catch (ServerNotActiveException e) {
            return "unknown";
        }
    }

    public static String handler(int cookie) {
        return String.format("Handler(//@@=%d)", cookie);
    }

    public static String client() {
        return String.format("Client(//%s)", host());
    }

    public static String client(int cookie) {
        return String.format("Client(//%s/@@=%d)", host(), cookie);
    }

    public static String server() {
        return String.format("Server(//%s)", host());
    }

    public static String server(String name) {
        return String.format("LocalServer(%s)", name);
    }
}

